<?php /* SVN: $Id: add.ctp 52633 2011-05-05 05:52:15Z sakthivel_135at10 $ */ ?>
<?php echo $this->element('js_tiny_mce_setting', array('cache' => array('time' => Configure::read('site.element_cache'))));?>
<div class="advertisers form js-responses">
<?php 
	echo $form->create('Advertiser', array( 'class' => 'normal  js-upload-form {is_required:"false"}', 'enctype' => 'multipart/form-data'));	
?>

	<div class="js-validation-part">
		<h2><?php echo __l('Edit Advertiser');?></h2>
		
		<fieldset class="form-block round-5">
			<legend class="round-5"><?php echo __l('Advertiser Info'); ?></legend>
			<div class="clearfix">
				
				<?php echo $form->input('name', array('label' => __l('Name')));?>								
				<?php echo $form->input('type',array('type'=>'select','options'=>array(1=>'Image',2=>'Code')))?>
                <?php echo $form->input('position',array('type'=>'select','options'=>Advertiser::positions()))?>
                <?php echo $form->input('link', array('label' => __l('Link')));?>
                <div class="clearfix date-time-block" style="padding-left: 50px;">
					<div class="input date-time end-date-time-block clearfix js-anytime-deal">
						<div class="js-datetime">
							<?php echo $form->input('end_date', array('label' => __l('End Date'),'minYear' => date('Y'), 'maxYear' => date('Y') + 10, 'div' => false, 'empty' => __l('Please Select'))); ?>
						</div>
					</div>
				</div>
                
			</div>
		</fieldset>
        
        <fieldset class="form-block round-5 js-advertiser-cities">
			<legend class="round-5"><?php echo __l('Advertiser Cities'); ?></legend>
			<div class="input cities-block ">
				<label><?php echo __l('Cities');?></label>
			</div>
			<?php 
				if(empty($this->data['Advertiser']['City']) && empty($city_id)): ?>
					<div class="cities-checkbox-block clearfix">
						<?php
						echo $form->input('City',array('label' =>false,'multiple'=>'checkbox')); ?>
					</div>
					<?php
				else:
				 ?>
				 <div class="cities-checkbox-block clearfix">
				 <?php
					echo $form->input('City',array('label' => false,'multiple'=>'checkbox'));
				?>
					</div>
				<?php
				endif;
			?>
		</fieldset>  
        
        <fieldset class="form-block round-5" id="imagefile">
		<legend class="round-5"><?php echo __l('Advertiser Image'); ?></legend>
           <div class="clearfix attachment-delete-outer-block">
			<?php
			 if(!empty($this->data['Attachment'][0])) {?>
             	<ul>
				<?php
					
            	$i =0;
            	foreach($this->data['Attachment'] as $CloneAttachment){ ?>
                	<li>	
						<div class="attachment-delete-block">
						  <span class="delete-photo"> <?php echo __l('Delete Photo'); ?></span>
                <?php 
                echo $form->input('OldAttachment.'.$CloneAttachment['id'].'.id', array('type' => 'checkbox', 'class'=>'','id' => "gig_checkbox_".$attachment['id'], 'label' => false));
                echo $form->input('CloneAttachment.'.$i.'.id', array('type' => 'hidden', 'value' => $CloneAttachment['id']));
				echo $html->showImage('Advertiser', $CloneAttachment, array('dimension' => 'normal_thumb', 'alt' => sprintf(__l('[Image: %s]'), $html->cText($this->data['advertiser']['name'], false)), 'title' => $html->cText($this->data['advertiser']['name'], false)));
				$i++;?>
				</div>
                </li>
                
				<?php 
				}?>
                </ul>
            <?php }	?>
            </div>
              <?php echo $form->input('Attachment.filename', array('type' => 'file','size' => '33', 'label' => __l('Upload Image'), 'class' =>'browse-field'));?>
		</fieldset>
        
        <fieldset class="form-block round-5" id="imagefile">
		<legend class="round-5"><?php echo __l('Advertiser Code'); ?></legend>
			<div class="clearfix">
                <?php echo $form->textarea('code',array('cols'=>80,'rows'=>10))?>
            </div>
		</fieldset>
        
	<div class="submit-block">
    <?php echo $form->submit(__l('Update')); ?>
    <div class="cancel-block">
		<?php
		echo $html->link(__l('Cancel'), array('controller' => 'advertisers', 'action' => 'index', 'admin' => true), array('class' => 'cancel-button'));
        ?>
    </div>
    </div>
   
<?php echo $form->end();
?>
</div>